﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Profile;
using System.Data;

namespace WebSite.cn
{
    public partial class category_list : System.Web.UI.Page
    {
        // Fields

        public string classmsg = "";

        public string pinmsg = "";


        // Methods
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                string sql = "select classid,classname from DB_Productclass where parentid=0 and visible=1 order by classorder";
                DataTable table = SQLAccess.GreatDs(sql).Tables[0];
                if (table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        string classmsg = this.classmsg;
                        this.classmsg = classmsg + "<h1><a href='products_category.aspx?typeid=" + row[0].ToString() + "' target='_blank'>" + row[1].ToString() + "</a></h1>";
                        DataTable table2 = SQLAccess.GreatDs("select classid,classname from DB_Productclass where parentid=" + row[0] + " and visible=1 order by classorder").Tables[0];
                        if (table2.Rows.Count > 0)
                        {
                            this.classmsg = this.classmsg + "<ul>";
                            foreach (DataRow row2 in table2.Rows)
                            {
                                string str4 = this.classmsg;
                                this.classmsg = str4 + "<li><a href='products_category.aspx?typeid=" + row2[0].ToString() + "' target='_blank'>" + row2[1].ToString() + "</a> </li>";
                            }
                            this.classmsg = this.classmsg + "</ul>";
                        }
                    }
                }
                sql = "select pinpaiid,pinpainame from DB_Pinpai where visible=1 order by pinpaiorder";
                table = SQLAccess.GreatDs(sql).Tables[0];
                if (table.Rows.Count > 0)
                {
                    foreach (DataRow row3 in table.Rows)
                    {
                        this.pinmsg = this.pinmsg + "<tr>";
                        string pinmsg = this.pinmsg;
                        this.pinmsg = pinmsg + "<td> &nbsp;<a href='products_category.aspx?pinid=" + row3["pinpaiid"].ToString() + "'>" + row3["pinpainame"].ToString() + "</a></td>";
                        this.pinmsg = this.pinmsg + "</tr>";
                    }
                }
            }
        }



    }
}